using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OpenLastDoor : MonoBehaviour
{
    public GameObject door;
    public EnemyStats boss;

    public bool isOpen;
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!isOpen && collision.GetComponent<Player>() != null && (boss == null || boss.IsDead || !boss.transform.gameObject.activeSelf))
        {
            isOpen = true;
            door.transform.Rotate(0, -60, 0);
            door.GetComponent<BoxCollider2D>().isTrigger = true;
        }
    }
}
